import { listPaper_type} from "@/api/paper/paper_type";
export const paperType = {
  data() {
    return {
      // 遮罩层
      ploading: true,
      // 选中数组
      pid: '',
      pname: '',
      // 显示搜索条件
      pshowSearch: true,
      // 总条数
      ptotal: 0,
      // 试卷分类表格数据
      ppaper_typeList: [],
      // 查询参数
      pqueryParams: {
        pageNum: 1,
        pageSize: 10,
        name: null,
        other: null
      },
       // 选择试卷分类弹出框
      paperVisible: false,
      // 考试设置界面需要的参数
      paindex: null,
    };
  },
  created() {
    this.pgetList();
  },
  methods: {
     // 弹出卷库选择框
     paperType(paindex){
      console.log('试卷分类选择');
      this.paperVisible = true;
      this.paindex = paindex;
    },

    /** 查询试卷分类列表 */
    pgetList() {
      this.ploading = true;
      listPaper_type(this.pqueryParams).then(response => {
        this.ppaper_typeList = response.rows;
        this.ptotal = response.total;
        this.ploading = false;
      });
    },


    /** 搜索按钮操作 */
    phandleQuery() {
      this.pqueryParams.pageNum = 1;
      this.pgetList();
    },
    /** 重置按钮操作 */
    presetQuery() {
      // this.resetForm("queryForm");
      this.phandleQuery();
    },
    // 关闭内部对话框    用户点击确定
    closePaperDialogT() {
      if (this.paindex >= 0) {
        this.addForm.sessionList[this.paindex].paperTypeId = this.pid;
        this.addForm.sessionList[this.paindex].paperTypeName = this.pname;

      } else {
        this.form.paperTypeName = this.pname;
        this.form.paperTypeId = this.pid;
        this.queryParams.paperTypeName = this.pname;
        this.queryParams.paperTypeId = this.pid;
        this.selform.paperTypeName = this.pname;
        this.selform.paperTypeId = this.pid;
      }
     this.paperVisible=false;
    },




   // 关闭内部对话框，   用户点击取消
   closePaperDialogF(){
     this.paperVisible=false;
     this.pid = null;
     this.pname = null;
   },
   prowclick(e){
     console.log(e);
     this.pid = e.id;
     this.pname = e.name;
   },



  }

};
